<template>
  <basic-dialog
    :visible="visible"
    :title="'审核驳回原因'"
    :ok-text="'确认'"
    :show-close="false"
    :handle-ok="handleConfirm"
    :handle-close="onCancel"
    :width="'40%'"
  >
    <div class="form-container">
      <el-form ref="auditForm" :rules="rules" :model="auditForm">
        <el-form-item label="" prop="auditNote">
          <el-input
            v-model.trim="auditForm.auditNote"
            type="textarea"
            placeholder="请输入驳回原因"
						maxlength="200"
          ></el-input>
        </el-form-item>
      </el-form>
    </div>
  </basic-dialog>
</template>
<script>
import BasicDialog from '@/components/BasicDialog';

export default {
  name: 'AuditDialog',
  components: {
    BasicDialog
  },
  props: {
    dialogVisible: {
      type: Boolean
    }
  },
  computed: {
    visible () {
      return this.dialogVisible;
    }
  },
  data () {
    return {
      auditForm: {
        auditNote: ''
      },
      rules: {
        auditNote: [
          { required: true, message: '请输入驳回原因', trigger: 'blur' },
        ]
      }
    };
  },
  methods: {
    onCancel () {
      this.$emit('hide-handler');
    },
    handleConfirm () {
      this.$refs.auditForm.validate((vaild) => {
        if (vaild) {
          this.$emit('confirm-submit', this.auditForm);
        }
      });
    }
  }
};
</script>
<style lang="less">
.form-container {
  .supplier-info {
    margin-bottom: 10px;
  }
}
</style>
